<!DOCTYPE html>
<html lang="zh">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>改变定位层级顺序</title>
  <style>
    div {
      position: absolute;

    }

    .box1 {
      width: 200px;
      height: 200px;
      background-color: #f00;
      z-index: 1;
    }

    .box2 {
      width: 100px;
      height: 100px;
      background-color: #ff0;
    }
  </style>
</head>

<body>
  <div class="box1">1</div>
  <div class="box2">2</div>
</body>

</html>